import { fetch } from './fetch'

/**
 * 今日课程
 * by Jehu
*/
// 获取 今日课程 数据
export const obtainDengesCourse = (open_id, batch_id, student_id, union_id) => fetch('POST', '/weapp/getCourse', {
  open_id,
  batch_id,
  student_id,
  union_id
})

/**
 * 课程详情
 * by Jehu
 */
// 获取 课程详情 数据
export const obtainCourseParticulars = (section_id, batch_id, union_id, student_id) => fetch('POST', '/weapp/getDetails', {
  section_id,
  batch_id,
  union_id,
  student_id
})
// 获取 课程报名人数
export const obtainCourseApply = (batch_id, open_id, union_id) => fetch('POST', '/weapp/courseApply', {
  batch_id,
  open_id,
  union_id
})

// 修改 课程详情 完成状态
export const amendCourseParticulars = (student_id, batch_id, section_id, section_video, class_time) => fetch('POST', '/weapp/updateState', {
  student_id,
  batch_id,
  section_id,
  section_video,
  class_time
})
// 获取 评论列表 数据
export const obtainCommmentList = (batch_id, section_id, page) => fetch('POST', '/weapp/getComment', {
  batch_id,
  section_id,
  page
})
// 发布 评论内容 数据
export const releaseCommmentContent = (job_id, to_uid, from_id, back_comment) => fetch('POST', '/weapp/comment/add', {
  job_id,
  to_uid,
  from_id,
  back_comment
})
// 删除 评论内容 数据
export const removeCommmentContent = (to_uid, comment_id) => fetch('POST', '/weapp/delComment', {
  to_uid,
  comment_id
})
// 判断 是否重复 提交作业
export const judgeTaskRepetition = (section_id, student_id) => fetch('POST', '/weapp/getTask', {
  section_id,
  student_id
})
// 发布 评论点评 数据
export const releaseCommmentOpinion = (job_id, teacher_id, teach) => fetch('POST', '/weapp/job/updateJobTeach', {
  job_id,
  teacher_id, 
  teach
})

/**
 * 作业详情
 * by Jehu
 */
// 获取 作业详情 数据
export const obtainTaskParticulars = (job_id, open_id, union_id) => fetch('POST', '/weapp/getParticulars', {
  job_id,
  open_id,
  union_id
})
// 统计 意志力获奖情况
export const statAwardsCase = (student_id, batch_id) => fetch('POST', '/weapp/statClockCase', {
  student_id, 
  batch_id
})

/**
 * 课程支付
 * by Jehu
*/
// 获取 课程支付 数据
export const obtainCoursePayParam = (type_id, batch_id) => fetch('POST', '/weapp/getPayment', {
  type_id,
  batch_id
})
// 获取 优惠券 数据
export const obtainPromotionCode = (open_id, union_id) => fetch('POST', '/weapp/student/temployCoupon', {
  open_id,
  union_id
})
// 获取 邀请码 数据
export const obtainInviteCode = (invite_code) => fetch('POST', '/weapp/getInvite', {
  invite_code
})
// 修改 邀请码 数据
export const amendInviteCode = (invite_code, state) => fetch('POST', '/weapp/updInvite', {
  invite_code,
  state
})
// 修改 优惠券 数据
export const amendPromotionCode = (g_id, g_state) => fetch('POST', '/weapp/updPromotion', {
  g_id, 
  g_state
})
// 获取 微信支付 配置参数
export const obtainWXPayParam = (openid, union_id, body, total_fee, gross_price, nickName, coupon_id, invite_code, type, type_id, batch_id) => fetch('POST', '/weapp/getWXPay', {
  openid,
  union_id,
  body,
  total_fee,
  gross_price,
  nickName,
  coupon_id,
  invite_code,
  type,
  type_id,
  batch_id
})
// 确定 课程订单 数据
export const amendCourseIndent = (order_id, amount, gross_price, nickName, invite_code, type, open_id, union_id, type_id, batch_id) => fetch('POST', '/weapp/updindent', {
  order_id,
  amount,
  gross_price,
  nickName,
  invite_code,
  type,
  open_id,
  union_id,
  type_id,
  batch_id
})
// 取消 课程订单 数据
export const cancelCourseIndent = (order_id) => fetch('POST', '/weapp/aboindent', {
  order_id
})
/**
 * 我的
 * by Jehu
*/
// 获取 我的 数据
export const obtainPersonalCenter = (batch_id, openId, unionId) => fetch('POST', '/weapp/getPersonal', {
  batch_id,
  open_id: openId,
  union_id: unionId
})
// 获取 我的老师 数据
export const obtainPersonalTeacher = (batch_id) => fetch('POST', '/weapp/getTeacher', {
  batch_id
})
// 获取 我的作业 数据
export const obtainPersonalTask = (page, student_id) => fetch('POST', '/weapp/job/obtainAllJob', {
  page, 
  student_id
})

// 获取 我的证书 数据
export const obtainPersonalCertificate = (open_id, user_name, union_id) => fetch('POST', '/weapp/getCertificate', {
  open_id,
  user_name,
  union_id
})
// 获取 我的礼券 数据
export const obtainPersonalCoupon = (open_id, union_id) => fetch('POST', '/weapp/student/giftList', {
  open_id,
  union_id
})
// 兑换 礼盒
export const convertPersonalGift = (g_id, open_id, user_name, address, phone, union_id) => fetch('POST', '/weapp/student/employGift', {
  g_id, 
  open_id, 
  user_name, 
  address, 
  phone,
  union_id
})
// 获取 常见问题 数据
export const obtainCommonProblem = (page) => fetch('POST', '/weapp/getProblem', {
  page
})
// 获取 参与课程数据 数据
export const obtainPersonalCourse = (open_id, page, union_id) => fetch('POST', '/weapp/getParticipate', {
  open_id,
  page,
  union_id
})
// 获取 用户信息
export const obtainUserinfo = (open_id, union_id) => fetch('POST', '/weapp/getUserinfo', {
  open_id,
  union_id
})
// 保存 用户信息
export const preserveUserinfo = (open_id, batch_id, student_id, union_id) => fetch('POST', '/weapp/keepUserinfo', {
  open_id, 
  batch_id, 
  student_id,
  union_id
})
// 修改 用户信息
export const amendUserinfo = (open_id, batch_id, student_id, guide_state, union_id) => fetch('POST', '/weapp/alterUserinfo', {
  open_id, 
  batch_id, 
  student_id, 
  guide_state,
  union_id
})
/**
 * 意志计划
 * by Jehu
*/
// 获取 意志计划 数据
export const obtainVolitionProject = () => fetch('POST', '/weapp/getVolition', {})
/**
 * 曲谱
 * by Jehu
*/
// 获取 曲谱库 数据
export const obtainMusicScore  = (page, open_id, union_id) => fetch('POST', '/weapp/getScore', {
  page,
  open_id,
  union_id
})
// 获取 我的曲谱 数据
export const obtainCollectScore  = (page, open_id, union_id) => fetch('POST', '/weapp/mineScore', {
  page,
  open_id,
  union_id
})
// 获取 曲谱详情 数据
export const obtainScoreDetails  = (score_id, open_id, union_id) => fetch('POST', '/weapp/gainScore', {
  score_id,
  open_id,
  union_id
})
// 搜索 曲谱 数据
export const searchMusicScore  = (text, page, open_id, union_id) => fetch('POST', '/weapp/searchScore', {
  text,
  page,
  open_id,
  union_id
})
// 添加 曲谱 到收藏库
export const appendScoreToCollect = (score_id, open_id, union_id) => fetch('POST', '/weapp/appendCollect', {
  score_id,
  open_id,
  union_id
})
// 移除 曲谱 于收藏库
export const removeScoreToCollect = (score_id, open_id, union_id) => fetch('POST', '/weapp/removalCollect', {
  score_id,
  open_id,
  union_id
})
// 累加 曲谱 浏览量
export const cumulativeHotOfScore = (score_id) => fetch('POST', '/weapp/addHot', {
  score_id
})
/**
 * 精选作业
 * by Jehu
*/
// 获取 精选作业 列表
export const obtainFeaturedTask = (page, student_id) => fetch('POST', '/weapp/job/recommendList', {
  page,
  student_id
})
// 获取 作业详情 数据
export const obtainTaskCircumstance = (student_id, job_id) => fetch('POST', '/weapp/job/studentJobDetails', {
  student_id,
  job_id
})
// 点赞 作业详情 数据
export const likeTaskCircumstance = (student_id, job_id) => fetch('POST', '/weapp/job/praise', {
  student_id,
  job_id
})

/**
 * 课程介绍
 * by 熊
*/
// 获取 课程介绍 数据
export const getReferral = (open_id, union_id) => fetch('post', '/weapp/getReferral', {
  open_id,
  union_id
})
// 验证学员付费情况
export const checkStudent = (union_id,open_id) => fetch('post', '/weapp/checkStudent', {
  union_id,
  open_id
})
// 判断用户行为
export const obtainJudgeConduct = (union_id,batch_id) => fetch('post', '/weapp/judgeConduct', {
  union_id,
  batch_id
})
/**
 * 课程计划
 * by 熊
*/
// 获取课程计划
export const obtainCourseStage = (batch_id) => fetch('post', '/weapp/courseStage', {
  batch_id
})
// 获取学员课程完成度
export const obtainCourseStudentFinish = (student_id) => fetch('post', '/weapp/courseStudentFinish', {
  student_id
})
// 获取学员意志力计划
export const obtainCourseWillPlan = (batch_id,union_id) => fetch('post', '/weapp/courseWillPlan', {
  batch_id,
  union_id
})


/**
 * 作业
 * by 熊
*/
// 添加学员作业
export const addStudentJob = (student_id, open_id , content,section_id,location,union_id) => fetch('post', '/weapp/job/add', {
  student_id, 
  open_id, 
  content,
  section_id,
  location,
  union_id
})

/**
 * 上传文件
 * by 熊
*/
// 获取加密
export const obtainUploadCryptoString = (commonPolicy,key) => fetch('post', '/weapp/uploadCrypto', {
  commonPolicy,
  key
})


/**
 * 服务通知
 * by 熊
*/
// 保存form_id 用于每天的推送
export const saveStudentFormId = (open_id,form_id) => fetch('post', '/weapp/saveStudentFormId', {
  open_id,
  form_id
})


/**
 * 群分享
 * by 熊
*/
// 获取群聊里面的成员
export const obtainGroup = (encryptedData, iv,code,batch_id) => fetch('post', '/weapp/obtainGroup', {
  encryptedData, 
  iv,
  code,
  batch_id
})
// 获取分享群聊批次下的成员排行
export const obtainShareTopSpot = ( batch_id,page,group_id) => fetch('post', '/weapp/obtainShareTopSpot', {
  batch_id,
  page,
  group_id
})
// 获取批次里面的成员
export const obtainBatchTopSpot = ( batch_id,page) => fetch('post', '/weapp/obtainBatchTopSpot', {
  batch_id,
  page
})

/**
 * 我的
 * by 熊
*/
// 我收到的评论
export const obtainReceiveComment = ( student_id,page) => fetch('post', '/weapp/job/receiveComment', {
  student_id,
  page
})

// 我收到的赞
export const obtainReceivePraise = ( student_id,page) => fetch('post', '/weapp/job/receivePraise', {
  student_id,
  page
})

